package architect.design.patterns.structural.bridge;

/**
 * 桥接模式
 *
 * @author guanxin
 * @date 2018/5/5 14:45
 */

public class ClientCase {

    public static void main(String[] args) {
        OSType os = OSType.LINUX;

        IFileDownloader fileDownloader = null;
        switch (os) {
            case LINUX:
                fileDownloader = new FileDownloader(new LinuxFileDownloader());
                break;
            case WINDOWS:
                fileDownloader = new FileDownloader(new WindowsFileDownloader());
                break;
            default:
                System.out.println("OS not supported !!");
        }

        Object fileContent = fileDownloader.download("file path");
        fileDownloader.store(fileContent);
        fileDownloader.delete("file path");
    }
}
